﻿; (function (window, undefined, $) {
    var submiting = false;
    $('#frmEdit').validator({
        rules: {

        },
        fields: {
            '#Reservename': 'required',
            '#Mobilenumber': 'required',
            '#ReserveDate': 'required'
        },
        valid: function (form) {
            if (submiting) {
                return;
            }
            submiting = true;
            FormSubmit(form, function(res) {
                if (res.Status > 0) {
                    alert("操作成功！");
                    window.location.href = "/Admin/Asset/AssetReservelist";
                } else if (res.Status == -1) {
                    alert(res.Message);
                } else if (res.Status == -2) {
                    $("#Mobilenumber").focus();
                    alert(res.Message)
                }
                submiting = false;
            });
        }
    });


    $("#btnSave").click(function (e) {
        $("#frmEdit").submit();
    });
    $("#btnReturn").click(function (e) {
        window.location.href = "/Admin/Asset/AssetReservelist";
    });
})(window, undefined, jQuery);